#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int sum(int n)
{
	if(n > 9)
	{
		return n % 10 + sum(n / 10);
	}
	else
	{
		return n;
	}
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	printf("%d", sum(n));
	return 0;
}